import { type baseListInfo } from '@/page/types/base/baseList'
import { type pageInfo } from '@/page/types/base/baseRequestPage'

export interface dictKeyInfo {
  /**
   * Id 生成策略为UUID
   */
  id: string
  /**
   * 创建时间 填充策略为插入自动填充
   */
  createTime: string
  /**
   * 字典key,首字母大写
   */
  dictKey: string
  /**
   * 字典名称
   */
  dictName: string
  /**
   * 字段所属业务类型  0 主业务 1 其他
   */
  dictType: string
  /**
   * 父ID
   */
  pid: string | null
  /**
   * 备注
   */
  remark: string
  /**
   * 权重
   */
  sort: number
}

export interface dictKeyS extends pageInfo {
  /**
   * 字典key,首字母大写
   */
  dictKey: string
  /**
   * 字典名称
   */
  dictName: string
}

export class dictKeyClass {
  dialogDictKey = false
  selectDictKey = [] as baseListInfo[]
  tableData = [] as dictKeyInfo[]
  page = 0
  size = 10
  total = 0
  dictTypeList = [
    {
      id: 0,
      name: '主业务'
    },
    {
      id: 1,
      name: '其他'
    }
  ]

  rules = {
    dictKey: [
      {
        required: true,
        message: '字典编码不能为空',
        trigger: 'blur'
      }
    ],
    dictName: [
      {
        required: true,
        message: '字典名称不能为空',
        trigger: 'blur'
      }
    ],
    dictType: [
      {
        required: true,
        message: '字典类型不能为空',
        trigger: 'blur'
      }
    ],
    sort: [
      {
        required: true,
        message: '排序不能为空',
        trigger: 'blur'
      }
    ]
  }

  dictKeyS: dictKeyS = {
    dictKey: '',
    dictName: '',
    page: 1,
    size: 10,
    total: 0
  }

  dictKeyEdit: dictKeyInfo = {
    id: 0,
    createTime: '',
    dictKey: '',
    dictName: '',
    dictType: '',
    pid: null,
    remark: '',
    sort: 0
  }
}
